package ui.adapter;

import android.graphics.Color;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.fy.fyzf.R;
import com.fy.fyzf.bean.ExChangeRecordBean;

import java.util.List;

public class ExchangeRecordAdapter extends BaseQuickAdapter<ExChangeRecordBean.ListBean, BaseViewHolder> {

    public ExchangeRecordAdapter() {
        super(R.layout.item_exchange_record );
    }

    @Override
    protected void convert(BaseViewHolder helper, ExChangeRecordBean.ListBean item) {
        helper.setText(R.id.tv_name, item.getMallTitle())
                .setText(R.id.tv_integral, "-" + item.getMallIntegral() + "积分")
                .setText(R.id.tv_time, item.getCreateTime());

        if (item.getExchangeStart() == 1) {
            helper.setText(R.id.tv_status, "已兑换");
            helper.setTextColor(R.id.tv_status, Color.parseColor("#DF2627"));
        } else {
            helper.setTextColor(R.id.tv_status, Color.GRAY);
            helper.setText(R.id.tv_status, "未兑换");
        }
    }
}
